package com.zjuh.taofood.web.action;

import wint.help.biz.result.Result;
import wint.mvc.flow.FlowData;
import wint.mvc.form.Form;
import wint.mvc.module.annotations.Action;
import wint.mvc.template.Context;

import com.zjuh.taofood.biz.ao.TopicAO;
import com.zjuh.taofood.biz.dao.query.TopicQuery;
import com.zjuh.taofood.biz.domain.TopicDO;
import com.zjuh.taofood.web.common.BaseAction;

public class Topic extends BaseAction {
	
	private TopicAO topicAO;
	
	public void detail(FlowData flowData, Context context, long topicId, int itemsPage) {
		Result result = topicAO.viewTopicDetail(topicId, itemsPage);
		this.handleResult(result, flowData, context);
	}
	
	public void list(FlowData flowData, Context context, int page) {
		TopicQuery topicQuery = new TopicQuery();
		topicQuery.setPageNo(page);
		topicQuery.setPageSize(60);
		Result result = topicAO.viewTopicList(topicQuery);
		this.handleResult(result, flowData, context);
	}
	
	@Action(defaultTarget="topic/create")
	public void doCreate(FlowData flowData) {
		Form form = flowData.getForm("topic.create");
		TopicDO topicDO = new TopicDO();
		if (form.apply(topicDO)) {
			
		}
	}

	public void setTopicAO(TopicAO topicAO) {
		this.topicAO = topicAO;
	}


}
